package org.vsb.chmireader.log;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Log4J helper for easy logging
 * 
 * @author Petr Blaha
 * 
 */
public class LogUtils {

    public static Logger getLog(String name) {
        return LoggerFactory.getLogger(name);
    }

    public static Logger getLogForMyClass() {
        String s;
        try {
            s = CurrentClassGetter.getClassName();
        } catch (Exception e) {
            s = "UnknownClass";
        }
        return getLog(s);
    }

//    public static Logger getLogForMyClass(String name) {
//        return getLog(CurrentClassGetter.getClassName() + "." + name);
//    }


    private static class CurrentClassGetter extends SecurityManager {

        public static String getClassName() {
            return new CurrentClassGetter().getClassContext()[2].getName();
        }
    }
}